import request from '@/utils/request'

// 查询销售单列表
export function listBizOrder (query) {
  return request({
    url: '/biz/bizOrder/list',
    method: 'get',
    params: query
  })
}

// 查询销售单详细
export function getBizOrder (id) {
  return request({
    url: '/biz/bizOrder/' + id,
    method: 'get'
  })
}

// 新增销售单
export function addBizOrder (data) {
  return request({
    url: '/biz/bizOrder',
    method: 'post',
    data: data
  })
}

// 销售单补单
export function spplementBizOrder (data) {
  return request({
    url: '/biz/bizOrder/spplement',
    method: 'post',
    data: data
  })
}

// 修改销售单
export function updateBizOrder (data) {
  return request({
    url: '/biz/bizOrder',
    method: 'put',
    data: data
  })
}

// 删除销售单
export function delBizOrder (id) {
  return request({
    url: '/biz/bizOrder/' + id,
    method: 'delete'
  })
}

// 获取初始化数据
export function getInitData (dictTypes) {
  return request({
    url: '/biz/bizOrder/getInitData/' + dictTypes,
    method: 'get'
  })
}

//销售单审核
export function auditOrder (id,status) {
  return request({
    url: '/biz/bizOrder/audit/' + id + ':' + status,
    method: 'get'
  })
}

//销售单强制完成
export function endOrder (id) {
  return request({
    url: '/biz/bizOrder/endOrder/' + id,
    method: 'get'
  })
}
//销售单领料
export function changeOrder (id,status) {
  return request({
    url: '/biz/bizOrder/change/' + id + ':' + status,
    method: 'get'
  })
}
// 获取下达生产基础信息
export function getProcessDetail (orderId) {
  return request({
    url: `/biz/bizOrderProduct/detailList/${orderId}`,
    method: 'get'
  })
}
// 下达生产
export function processOrder (data) {
  return request({
    url: '/biz/bizOrder/process',
    method: 'post',
    data: data
  })
}

// 安装
export function installOrder (data) {
  return request({
    url: '/biz/bizOrder/install',
    method: 'post',
    data: data
  })
}

// 水槽
export function sinkArrivalOrder (data) {
  return request({
    url: '/biz/bizOrder/sink',
    method: 'post',
    data: data
  })
}

// 获取配送、安装人员信息
export function bizOrderInstaller (data) {
  return request({
    url: '/biz/bizOrderInstaller/list',
    method: 'get',
    data: data
  })
}
export function addAccessory (data) {
  return request({
    url: '/biz/bizOrder/addAccessory',
    method: 'post',
    data: data
  })
}
// 发货完成
export function shipmentsStatus (data) {
  return request({
    url: '/biz/bizOrder/shipments',
    method: 'post',
    data: data
  })
}
// 发货完成
export function returnProcess (data) {
  return request({
    url: '/biz/bizOrder/returnProcess',
    method: 'post',
    data: data
  })
}
// 订单完成
export function completeOrder (data) {
  return request({
    url: '/biz/bizOrder/complete',
    method: 'post',
    data: data
  })
}
// 订单完成
export function updateOrderFee (data) {
  return request({
    url: '/biz/bizOrder/updateOrderHead',
    method: 'post',
    data: data
  })
}
// 检测地址重复
export function checkAddressUnique (param) {
  return request({
    url: '/biz/bizOrder/checkAddressUnique?id=' + param.id + '&address=' + param.address,
    method: 'get'
  })
}
// 导出销售订单
export function orderPrintExcel (param) {
  return request({
    url: '/biz/bizOrder/orderPrintExcel?id=' + param.id,
    method: 'get'
  })
}



